package com.剑指offer;

public class _58判断对称的二叉树
{
    boolean isSymmetrical(TreeNode node)
    {
        if (node == null)
        {
            return true;
        }
        return f(node.left, node.right);
    }

    boolean f(TreeNode t1, TreeNode t2)
    {
        if (t1 == null && t2 == null)
        {
            return true;
        }
        if (t1 != null && t2 != null)
        {
            return (t1.val == t2.val) && f(t1.left, t2.right) && f(t1.right, t2.right);
        }
        return false;
    }
}
